import axios from '../utils/request';
import { Dispatch } from 'redux';
import '../api/hoemList'
export const getList = () => {  //异步
    return async (dispatch: Dispatch) => {
        let res = await axios.get('/api/list')
        dispatch({
            type: 'setList',
            list: res.data.list
        })
    }
}

export const setList = (can: number) => {  // 常用基本方法
    return (dispatch: Dispatch) => {
        dispatch({
            type: 'xxx',
            list: can
        })
    }
}

export const setName = (can: string) => ({ // 简写
    type: 'xxx',
    data: can
})